package org.jrfe.gfx.g2d.text;

import org.jrfe.gfx.ColorRGBA;
import org.jrfe.math.Vector2f;

public abstract class Text {
	
	protected TextType type;
	protected Font font;
	protected Vector2f loc;
	protected float scale;
	
	protected ColorRGBA color;
	
	public Text(TextType type,Font font) {
		loc = new Vector2f();
		color = new ColorRGBA();
		scale = 1;
		this.type = type;
		this.font = font;
	}
	
	
	public ColorRGBA getColor() {
		return color;
	}
	
	public void setScale(float scale) {
		this.scale = scale;
	}
	
	public float getScale() {
		return scale;
	}
	
	public Vector2f getLoc() {
		return loc;
	}
	
	public int getTextWidth(){
		int width = 0;
		
		for (int i = 0; i < getText().length(); i++) {
			char chr = getText().charAt(i);
			
			width += font.getCharArray()[chr].width;
			
		}
		return width;
	}
	
	public abstract String getText();
	
	public abstract int getListId();
	
	public abstract void destory();
	
	public TextType getType() {
		return type;
	}
	
	public Font getFont() {
		return font;
	}
	
}
